﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Windows.Controls.Ribbon;

namespace ChoDiaOc_HK_WPF.Views {
    /// <summary>
    /// Interaction logic for ManHinhBaoBieu.xaml
    /// </summary>
    public partial class ManHinhBaoBieu : RibbonWindow {
        public ManHinhBaoBieu() {
            InitializeComponent();

            // Insert code required on object creation below this point.

            App.ManHinhBaoBieu = this;
        }

        private LapBaoBieu.ThongKeDiaOc thongKeDiaOcControl = null;

        public LapBaoBieu.ThongKeDiaOc ThongKeDiaOcControl {
            get {
                if (thongKeDiaOcControl == null) {
                    thongKeDiaOcControl = new LapBaoBieu.ThongKeDiaOc();
                } return thongKeDiaOcControl;
            }
        }

        private LapBaoBieu.ThongKeDoanhThu thongKeDoanhThuControl = null;

        public LapBaoBieu.ThongKeDoanhThu ThongKeDoanhThuControl {
            get {
                if (thongKeDoanhThuControl == null) {
                    thongKeDoanhThuControl = new LapBaoBieu.ThongKeDoanhThu();
                } return thongKeDoanhThuControl;
            }
        }

        private LapBaoBieu.ThongKeKhachHang thongKeKhachHangControl = null;

        public LapBaoBieu.ThongKeKhachHang ThongKeKhachHangControl {
            get {
                if (thongKeKhachHangControl == null) {
                    thongKeKhachHangControl = new LapBaoBieu.ThongKeKhachHang();
                } return thongKeKhachHangControl;
            }
        }

        private LapBaoBieu.ThongKeKhachHangTheoDichVu thongKeKhachHangTheoDichVuControl = null;

        public LapBaoBieu.ThongKeKhachHangTheoDichVu ThongKeKhachHangTheoDichVuControl {
            get {
                if (thongKeKhachHangTheoDichVuControl == null) {
                    thongKeKhachHangTheoDichVuControl = new LapBaoBieu.ThongKeKhachHangTheoDichVu();
                } return thongKeKhachHangTheoDichVuControl;
            }
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
            e.Cancel = true;
            this.Hide();
            gridMain.Children.Clear();
            thongKeDiaOcControl = null;
            thongKeDoanhThuControl = null;
            thongKeKhachHangControl = null;
            thongKeKhachHangTheoDichVuControl = null;           
            gridMain.Children.Add(ThongKeDiaOcControl);
        }

        private void Window_Loaded(object sender, RoutedEventArgs e) {
            gridMain.Children.Clear();
            gridMain.Children.Add(ThongKeDiaOcControl);
        }

        private void btnBack_Click(object sender, RoutedEventArgs e) {
            if (MessageBoxResult.OK == MessageBox.Show("Có chắc chắn không?", "Cảnh báo", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel, MessageBoxOptions.None)) {
                this.Close();
            }
        }

        private void btnThongKeDiaOc_Click(object sender, RoutedEventArgs e) {
            gridMain.Children.Clear();
            gridMain.Children.Add(ThongKeDiaOcControl);
        }

        private void btnThongKeDoanhThu_Click(object sender, RoutedEventArgs e) {
            gridMain.Children.Clear();
            gridMain.Children.Add(ThongKeDoanhThuControl);
        }

        private void btnThongKeKhachHang_Click(object sender, RoutedEventArgs e) {
            gridMain.Children.Clear();
            gridMain.Children.Add(ThongKeKhachHangControl);
        }

        private void btnThongKeKhachHangTheoDV_Click(object sender, RoutedEventArgs e) {
            gridMain.Children.Clear();
            gridMain.Children.Add(ThongKeKhachHangTheoDichVuControl);
        }       
    }
}
